package cc.vv.btpartyjob.delegate

import android.widget.EditText
import android.widget.ImageView
import android.widget.TextView
import cc.vv.baselibrary.util.ColorUtil
import cc.vv.baselibrary.view.BaseTopBarView
import cc.vv.btpartyjob.R
import cc.vv.mvp.delegate.BaseAppDelegate

/**
 * 新增党员报到托管类
 * Created by Chen.qi on 2018/10/27.
 */
class AddPartyRegisterActivityDelegate : BaseAppDelegate() {

    override fun initWidget() {

    }

    override fun initLayoutRes(): Int {
        return R.layout.activity_add_party_register
    }

    /**设置标题title*/
    fun setTopBarTitle(topBarTitle: String) {
        val titleBar = getView<BaseTopBarView>(R.id.btv_apr_topBar)
        titleBar?.setTitle(topBarTitle)
        titleBar?.setRightTVContent("退出登录")
        titleBar?.setRightTVColor(ColorUtil.setBCColor(R.color.color_FFFFFF))
    }


    /**设置标题右边按钮点击事件*/
    fun setTitleBackBtnOnClick(event: BaseTopBarView.EventInterface) {
        val titleBar = getView<BaseTopBarView>(R.id.btv_apr_topBar)
        titleBar?.setEventInterface(event)
    }

    /**
     * 设置报到街道地址数据
     */
    fun setStreetStr(streetStr: String) {
        getView<TextView>(R.id.tv_apr_registerStreet)?.text = streetStr
    }


    /**
     * 设置报到社区数据
     */
    fun setCommunityStr(communityStr: String) {
        getView<TextView>(R.id.tv_apr_registerCommunity)?.text = communityStr
    }


    /**
     * 设置单位网格数据
     */
    fun setWangGeUnitStr(wangGeUnitStr: String) {
        getView<TextView>(R.id.tv_apr_wangGe)?.text = wangGeUnitStr
    }

    /**
     * 设置单位网格数据
     */
    fun setDanWeiStr(wangGeUnitStr: String) {
        getView<TextView>(R.id.tv_apr_placeTheUnit)?.text = wangGeUnitStr
    }

    /**
     * 设置是否是志愿者
     */
    fun selectedVolunteer(isVolunteer: Boolean) {
        val viewYes = getView<ImageView>(R.id.iv_addVo_volunteerYes)
        val viewNo = getView<ImageView>(R.id.iv_addVo_volunteerNo)
        if (isVolunteer) {
            viewYes?.isSelected = true
            viewNo?.isSelected = false
        } else {
            viewYes?.isSelected = false
            viewNo?.isSelected = true
        }
    }

    /**
     * 设置党员姓名
     */
    fun setName(name: String?) {
        val viewRegister = getView<TextView>(R.id.et_apr_name)
        viewRegister?.text = name
    }

    /**
     * 获取联系电话
     */
    fun getPhone(): String {
        val viewRegister = getView<EditText>(R.id.et_apr_linkTelPhone)
        return viewRegister?.text.toString().trim()
    }

    /**
     * 获取职业特点
     */
    fun getZhiYeTeDian(): String {
        val viewRegister = getView<EditText>(R.id.et_apr_professionTd)
        return viewRegister?.text.toString().trim()
    }

    /**
     * 设置工作时间
     */
    fun setWorkTime(time: String?) {
        val viewRegister = getView<TextView>(R.id.tv_apr_workTime)
        viewRegister?.text = time
    }

    /**
     * 获取爱好特长
     */
    fun getAiHaoTeChang(): String {
        val viewRegister = getView<EditText>(R.id.et_apr_hobbyLove)
        return viewRegister?.text.toString().trim()
    }

    /**
     * 获取个人承诺
     */
    fun getGeRenChengNuo(): String {
        val viewRegister = getView<EditText>(R.id.et_apr_commitPerson)
        return viewRegister?.text.toString().trim()
    }


}